<script type="text/javascript">
$(function(){
	var pg = App.base.dirView.ui
		, pp = pg.params
		, frm = pg.find(".form")
		, tabs = pg.find('.tabs')
		, infoPl = pg.find('.infoPl')
		, projPl = pg.find('.projPl')
		, appPl = pg.find('.appPl')
		, libPl = pg.find('.libPl');
	
	function init(o){
		setValues(o);
		var items=[{
			code: 'infoPl',title: '基本信息',
			el: infoPl
		},{
			code: 'projPl',title: '子系统列表',
			auth: 'proj.list',
			render: function(p,c){
				App.show({
					ctx:'base',
					action: 'projList',
					params: {id:pp.id}
				},function(s){pg.callback(s)},p);
			}
		},{
			code: 'appPl',title: '应用列表',
			auth: 'app.list',
			render: function(p,c){
				App.show({
					ctx:'base',
					action: 'appList',
					params: {id:pp.id,ctxPg:'dirView'}
				}, pg.callback, p);
			}
		},{
			code: 'libPl',title: '库包列表',
			auth: 'lib.list',
			render: function(p,c){
				App.show({
					ctx:'base',
					action: 'libList',
					params: {id:pp.id}
				}, pg.callback, p);
			}
		}];
		var ctx = App.ctx.substring(1),
			ex = App[ctx].dirView;
		if (ex && ex.tabs) {
			for (var i=0; i<ex.tabs.length; i++) {
				items.push(ex.tabs[i]);
			}
		}
		items = $.map(items, function(a){
			if (a.auth && !App.logon.power(a.auth)) {
				if (a.el) {
					a.el.hide();
				}
				return null;
			}
			return a;
		});
		
		tabs.mac('tabs', {
			tabWidth: 80,
			tabHeight: 32,
			items: items
		}).selectFirst();

		function adjust(){
			var h = pg.parent().height();
			pg.height(h);
			tabs.width(pg.width());
			tabs.height(h-4);
			tabs.adjust();
			h = tabs.children('.body').height() - 44;
		}
		$(window).resize(adjust);
		adjust();
	}
	
	function setValues(o){
		frm.seek('code').text(o.code);
		frm.seek('name').text(o.name);
		frm.seek('memo').text(o.memo);
	}
	
	init(pg.params);
});
</script>
<div class="tabs"></div>
<div class="infoPl form">
	<div class="item">
		<span class="label">英文名：</span> <span class="value" name="code"></span>
	</div>
	<div class="item">
		<span class="label">中文名：</span> <span class="value" name="name"></span>
	</div>
	<div class="item">
		<span class="label">描述：</span> <span class="memo" name="memo"></span>
	</div>
</div>
<div class="projPl">
</div>
<div class="appPl">
</div>
<div class="libPl">
</div>